import React, { Component } from 'react';
import ContacterItem from './ContacterItem';

export default class ContacterList extends Component {
  render() {
    const{contacterItems} = this.props;
    let items = [];
    contacterItems.forEach((item) => {  
        let itemProps = {
            key : item.id,
            id: item.id,
            title : item.title,
            name : item.name,
            jobtitle : item.jobtitle,
            mobile : item.mobile
        };
        // const showBottom = (index < contacterItems.length - 1);
        items.push(
            <ContacterItem
                {...itemProps}
                onContacterClick={this.props.onContacterClick}
                showBottom={true}
            />
        );
    });

    return (        
      <div className="crm-card-contacter-list">
        {items}
      </div>
    );
  }
}